You give MegaSort parameters that tell it what container holds the records you want sorted, what character separates the records in the container, and what character separates the fields within the records.
You also tell MegaSort how you want the records sorted. You give parameters that specify what type of data is in the key, which field contains the key, whether you want the sort in ascending or descending order, and finally where the key lies within the field (the chunk).